﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace 期末考试
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //string strcon = "Data Source = .; Database =    Blogs; Integrated Security = True;Uid = sa; Pwd =123";
            //string strcon = "Data Source=LAPTOP-B66HUG0KSQLEXPRESS;Initial Catalog=Blogs;Integrated Security=True";
            //''SqlConnection sqlConnection = new SqlConnection(strcon);
            //sqlConnection.Open();

            //string sqlcom = "select * from Articles";

            //SqlCommand sqlCommand = new SqlCommand(sqlcom);

            //sqlCommand.CommandText = "select * from Articles";
            //sqlConnection.Open();

            //SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlcom, sqlConnection);

            //SqlCommandBuilder cmdbld = new SqlCommandBuilder(dataAdapter);

            //DataTable dt = new DataTable();
            //DataSet dataSet = new DataSet();
            //dataAdapter.Fill(dt);
           // return;
            //int rowCount = sqlCommand.ExecuteNonQuery();
            //this.dataGridView1.DataSource = dataSet.Tables[0];
            //dataGridView1.Show();
            //Form1 form = new Form1();
            //form.Hide();
            //Form2 form2 = new Form2();
            //form2.Show();
            //bindData(new SqlDA().select());
        }

        private void button1_Click(object sender, EventArgs e)
        {

            //string strConn = "Data Source=.;Initial Catalog=Blogs;Uid=sa;Pwd=123";

            //SqlConnection conn = new SqlConnection(strConn);
            //conn.Open();
            //string addSQL = "insert into Blogs values('1','2020.1.1','创新','小明')";
            //SqlCommand cmd = new SqlCommand(addSQL, conn);
            //int rowCount = cmd.ExecuteNonQuery();
            //conn.Close();
            Form4 insert = new Form4();
            insert.Owner = this;
            insert.Show();

        }

        private void button2_Click(object sender, EventArgs e)
        {

            //string strConn = "Data Source=.;Initial Catalog=Blogs;Uid=sa;Pwd=123";

            //SqlConnection conn = new SqlConnection(strConn);
            //conn.Open();
            //string updateSQL = "update Blogs set Id='2',创建时间='2020.2.1',文章标题='改革开放',作者='小芳'";
            //SqlCommand cmd = new SqlCommand(updateSQL, conn);
            //int rowCount = cmd.ExecuteNonQuery();
            //conn.Close();

        }

        private void button3_Click(object sender, EventArgs e)
        {
          
            //string strConn = "Data Source=.;Initial Catalog=Blogs;Uid=sa;Pwd=123";
            //SqlConnection conn = new SqlConnection(strConn);
            //conn.Open();
            //string delSQL = "delete from Blogs where 作者='小陈'";
            //SqlCommand cmd = new SqlCommand(delSQL, conn);
            //int rowCount = cmd.ExecuteNonQuery();
           // conn.Close();
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            //listView1.Items.Clear();
            //bindData(new SqlDA().select(textBox1.Text));
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Form2 insert = new Form2();
            insert.Owner = this;
            insert.Show();

        }

        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
          
            listView1.Columns.Add("账户");
            listView1.Columns.Add("密码");

            //foreach (sqlData data in list)

        }

        private void listView1_SelectedIndexChanged_1(object sender, EventArgs e)
        {

        }
    }
}
